import axios from './init'
import qs from 'qs'

export const login = async (data:{username:string, password:string}) => {
  if (!data.username || !data.password) return alert('参数有误')

  const { data: res } = await axios.post('login', qs.stringify(data))
  return res
}

export const getAllUser = async (params:{pagenum:number, query?:string, pagesize:number}) => {
  if (!params.pagenum || !params.pagesize) return new Error('参数错误')
  const { data: res } = await axios.get('users', { params })

  return res
}
